set mem 550m
set matsize 5000
log using "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\table5.log", replace
#delimit ;
set more 1;
*
* TABLE5.DO
* BY Alex Whalley
* VERSION OF 07/10/09
*
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET3d1p = ECFET3d1 / 1000; 
drop ECFET3d1;
rename ECFET3d1p ECFET3d1;
gen endowl4_spindexd3d1_1 = endowl4_spindexd3d1 / 1000;
drop endowl4_spindexd3d1;
rename endowl4_spindexd3d1_1 endowl4_spindexd3d1;
gen ECFET5d1p = ECFET5d1 / 1000; 
drop ECFET5d1;
rename ECFET5d1p ECFET5d1; 
gen endowl6_spindexd5d1_1 = endowl6_spindexd5d1 / 1000;
drop endowl6_spindexd5d1;
rename endowl6_spindexd5d1_1 endowl6_spindexd5d1;
*
* PART (1): EMPLOYMENT
*;
xi: reg lemp3d1 ECFET3d1 i.year [fw=semp81] if endowl4_spindexd3d1 !=., cluster(FIPSCOUNTY); 
xi: ivreg lemp3d1 (ECFET3d1=endowl4_spindexd3d1 ) i.year [fw=semp81], cluster(FIPSCOUNTY); 
sum  lemp3d1 if endowl4_spindexd3d1 !=.;
*
* PART (2): EMPLOYMENT
*;
xi: reg lemp5d1 ECFET5d1 i.year [fw=semp81] if endowl6_spindexd5d1 !=., cluster(FIPSCOUNTY); 
xi: ivreg lemp5d1 (ECFET5d1=endowl6_spindexd5d1 ) i.year [fw=semp81], cluster(FIPSCOUNTY); 
sum  lemp5d1 if endowl6_spindexd5d1 !=.;
*
* CLOSE LOG, CLEAR AND END
*;
log close;
*clear;